<?php
App::uses('AppController', 'Controller');
App::uses('CakeEmail', 'Network/Email');

class ContactUsController extends AppController {
    public function beforeFilter() {
        $this->Auth->allow('index');
    }

    
    public function index(){        
        //$this->helpers[] = 'GoogleMapV3';            
        if(!empty($this->data)){
            $email = new CakeEmail();
            $email->from (array($this->data['ContactUs']['email'] => 'Sambo'));
            $email->to('samsambo009@gmail.com');
            $email->subject($this->data['ContactUs']['subject']);
            $email->message($this->data['ContactUs']['name'] . '\n' . $this->data['ContactUs']['phone'] . '\n' . $this->data['ContactUs']['message']);            
            $email->send();
            $this->Session->flash("test");
            $this->redirect('contact-us');
        }
    }
}
?>
